package com.scy.java.loop;
//continue实例
public class ContinueExample {
    public static void main(String[] args) {
        exitLoop();
        labelMethod();
    }
//    带标签的continue
    public static void labelMethod(){
//        声明标识符（只要不是Java关键字）
        outsize:for (int i = 0; i <=5; i++) {
            for (int j = 0; j <=5; j++) {
                if (j==4){
                    continue outsize;
                }
                System.out.println("i的值为："+i+",j的值为："+j);

            }
        }
    }
    //continue终止当前循环
//    1-100之间能被3整除的数，控制台打印前五个
    public static void exitLoop(){
        int i = 1 ;
        int count = 0;
        while (i<100){
            i++;
            if(i%3==0){
                count++;
                if (count>=5){
                    continue ;

                }
                System.out.println(i);

            }

        }
    }
}
